﻿<Views:WindowBase x:Class="SharpTalk.Client.WpfApplication.Views.ChatRoomDetailsView"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:Resources="clr-namespace:SharpTalk.Client.WpfApplication.Resources"
        xmlns:Controls="clr-namespace:SharpTalk.Client.WpfApplication.Controls"
        mc:Ignorable="d" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
        xmlns:Views="clr-namespace:SharpTalk.Client.WpfApplication.Views"
        d:DesignHeight="328" d:DesignWidth="420"
        Style="{StaticResource MessageViewStyle}"
        MinWidth="420"
        MinHeight="250"
        MaxWidth="420"
        SizeToContent="WidthAndHeight">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition/>
            <RowDefinition Height="Auto"/>
        </Grid.RowDefinitions>
        <Grid Grid.Row="0" IsEnabled="{Binding HasChatRoom}">
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="Auto"/>
                <ColumnDefinition Width="*"/>
            </Grid.ColumnDefinitions>
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="Auto"/>
                <RowDefinition Height="*"/>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <TextBlock Text="{x:Static Resources:Messages.label_name}" Grid.Column="0" Grid.Row="0" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5"/>
            <TextBox Text="{Binding ChatRoomDetails.Name}" IsEnabled="{Binding IsNew}" Grid.Column="1" Grid.Row="0" VerticalAlignment="Center" Margin="5"/>
            <TextBlock Text="{x:Static Resources:Messages.label_type}" Grid.Column="0" Grid.Row="1" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5"/>
            <ComboBox SelectedItem="{Binding ChatRoomDetails.Type, Converter={StaticResource ChatRoomTypeEnumSimpleToStringConverter}}" ItemsSource="{Binding ChatRoomTypes}" Grid.Column="1" Grid.Row="1"  VerticalAlignment="Center" Margin="5"/>

            <!--<TextBlock Text="{x:Static Resources:Messages.label_password}" Grid.Column="0" Grid.Row="2" VerticalAlignment="Center" HorizontalAlignment="Right" Margin="5"/>-->
            <StackPanel Grid.Row="2" Grid.Column="1" Orientation="Horizontal">
                <Button Name="btnDefinePassword" Style="{StaticResource FlatButtonStyle}" HorizontalAlignment="Left" Margin="5" DockPanel.Dock="Left" Command="{Binding DefinePasswordCommand}">
                    <DockPanel LastChildFill="True">
                        <Image Style="{StaticResource ImageStylePassword}"/>
                        <TextBlock Margin="3,0" Text="{x:Static Resources:Messages.label_password_define}"/>
                    </DockPanel>
                </Button>
                <Button Name="btnClearPassword" Style="{StaticResource FlatButtonStyle}" IsEnabled="{Binding IsProtected}" HorizontalAlignment="Left" Margin="5" DockPanel.Dock="Left" Command="{Binding ClearPasswordCommand}">
                    <DockPanel LastChildFill="True">
                        <Image Style="{StaticResource ImageStyleClearPassword}"/>
                        <TextBlock Margin="3,0" Text="{x:Static Resources:Messages.label_password_clear}"/>
                    </DockPanel>
                </Button>
            </StackPanel>
            
            <GroupBox Margin="2,0,0,0" Header="{x:Static Resources:Messages.label_motd}" BorderThickness="0,1,0,0" Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="3" Grid.RowSpan="2" >
                <TextBox Margin="0,2,0,0" SpellCheck.IsEnabled="True" Text="{Binding ChatRoomDetails.Motd}" MaxLength="200" TextWrapping="Wrap" AcceptsReturn="True" AcceptsTab="True" />
            </GroupBox>
        </Grid>

        <Controls:DialogActionsPanel
            Grid.Row="1" 
            Grid.ColumnSpan="2"
            HorizontalAlignment="Right"
            ShowButtonOk="{Binding HasChatRoom, Converter={StaticResource ReversedBooleanToBoolConverter}}"
            ShowButtonCancel="True"
            ShowButtonYes="{Binding HasChatRoom}"
            ButtonOkContent="{x:Static Resources:Messages.label_create_new}"
            ButtonOkCommand="{Binding CreateNewCommand}"
            ButtonYesContent="{x:Static Resources:Messages.label_save}"
            ButtonYesCommand="{Binding ValidateCommand}"
            ButtonYesIsEnabled="{Binding HasChatRoom}"/>
    </Grid>
</Views:WindowBase>
